// https://leetcode-cn.com/problems/find-the-duplicate-number/
// 287. Find the Duplicate Number
function findDuplicate(nums: number[]): number {
    const set: Set<number> = new Set();

    for (let num of nums) {
        if (set.has(num)) return num;
        set.add(num);
    }

    return -1;
}
